package com.wujunshen.designpattern.creational.factory.nofactory;

import com.wujunshen.designpattern.creational.factory.BrandOne;
import com.wujunshen.designpattern.creational.factory.BrandTwo;
import com.wujunshen.designpattern.creational.factory.IVehicle;

import static com.wujunshen.designpattern.creational.factory.Constants.BRAND_ONE;
import static com.wujunshen.designpattern.creational.factory.Constants.BRAND_TWO;

/**
 * @author frank woo(吴峻申) <br>
 *     email:<a href="mailto:frank_wjs@hotmail.com">frank_wjs@hotmail.com</a> <br>
 * @date 2021/2/16 21:48<br>
 */
public class NoFactory {
  public static IVehicle createProduct(int brandCode) {
    IVehicle vehicle = null;
    if (BRAND_ONE == brandCode) {
      vehicle = new BrandOne();
    } else if (BRAND_TWO == brandCode) {
      vehicle = new BrandTwo();
    }

    return vehicle;
  }
}
